Add property editors
authorMatthias Clasen <matthiasc@src.gnome.org>
Wed, 26 Oct 2005 03:55:35 +0000 (03:55 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 26 Oct 2005 03:55:35 +0000 (03:55 +0000)
ChangeLog
ChangeLog.pre-2-10
tests/Makefile.am
tests/testentrycompletion.c

index 5b5fd10a7a65a41f6894c8735a93f0a776dc87e1..cb6538c177b898a6eb3f0de261f69ef09ab3febc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2005-10-25  Matthias Clasen  <mclasen@redhat.com>
 
+       * tests/Makefile.am:
+       * tests/testentrycompletion.c: Apply a patch by Christian
+       Persch to add property editors.
+
        * gtk/gtkstatusicon.c: Emit activate on single-click,
        not on double-click, change proposed by Milosz Derezynski.
 
index 5b5fd10a7a65a41f6894c8735a93f0a776dc87e1..cb6538c177b898a6eb3f0de261f69ef09ab3febc 100644 (file)
@@ -1,5 +1,9 @@
 2005-10-25  Matthias Clasen  <mclasen@redhat.com>
 
+       * tests/Makefile.am:
+       * tests/testentrycompletion.c: Apply a patch by Christian
+       Persch to add property editors.
+
        * gtk/gtkstatusicon.c: Emit activate on single-click,
        not on double-click, change proposed by Milosz Derezynski.
 
index 01f9ae02c804953bf909246f5500459b6fd49a65..f963b1a6e2c3a3eb0a2d33451aabc096cf54ac13 100644 (file)
@@ -169,6 +169,10 @@ testactions_LDADD = $(LDADDS)
 autotestfilechooser_SOURCES =  \
        autotestfilechooser.c
 
+testentrycompletion_SOURCES =  \
+       prop-editor.c           \
+       testentrycompletion.c
+
 testfilechooser_SOURCES =      \
        prop-editor.c           \
        testfilechooser.c       
index 92f69d432c4a3d3f396bc3c2b947134d91ef73fc..a0cf7d77525aa2a0ddc9c549c04acd61b7f9eece 100644 (file)
@@ -23,6 +23,8 @@
 #include <string.h>
 #include <gtk/gtk.h>
 
+#include "prop-editor.h"
+
 /* Don't copy this bad example; inline RGB data is always a better
  * idea than inline XPMs.
  */
@@ -288,6 +290,27 @@ match_selected_cb (GtkEntryCompletion *completion,
   return TRUE;
 }
 
+static void
+new_prop_editor (GObject *object)
+{
+       gtk_widget_show (create_prop_editor (object, G_OBJECT_TYPE (object)));
+}
+
+static void
+add_with_prop_edit_button (GtkWidget *vbox, GtkWidget *entry, GtkEntryCompletion *completion)
+{
+       GtkWidget *hbox, *button;
+
+       hbox = gtk_hbox_new (FALSE, 12);
+       gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+
+       gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
+
+       button = gtk_button_new_with_label ("Properties");
+       g_signal_connect_swapped (button, "clicked", G_CALLBACK (new_prop_editor), completion);
+       gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+}
+
 int 
 main (int argc, char *argv[])
 {
@@ -316,7 +339,6 @@ main (int argc, char *argv[])
 
   /* Create our first entry */
   entry = gtk_entry_new ();
-  gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
   
   /* Create the completion object */
   completion = gtk_entry_completion_new ();
@@ -326,6 +348,8 @@ main (int argc, char *argv[])
   gtk_entry_set_completion (GTK_ENTRY (entry), completion);
   g_object_unref (completion);
   
+  add_with_prop_edit_button (vbox, entry, completion);
+
   /* Create a tree model and use it as the completion model */
   completion_model = create_simple_completion_model ();
   gtk_entry_completion_set_model (completion, completion_model);
@@ -336,7 +360,6 @@ main (int argc, char *argv[])
 
   /* Create our second entry */
   entry = gtk_entry_new ();
-  gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
 
   /* Create the completion object */
   completion = gtk_entry_completion_new ();
@@ -345,6 +368,8 @@ main (int argc, char *argv[])
   gtk_entry_set_completion (GTK_ENTRY (entry), completion);
   g_object_unref (completion);
   
+  add_with_prop_edit_button (vbox, entry, completion);
+
   /* Create a tree model and use it as the completion model */
   completion_model = create_completion_model ();
   gtk_entry_completion_set_model (completion, completion_model);
@@ -372,7 +397,6 @@ main (int argc, char *argv[])
 
   /* Create our third entry */
   entry = gtk_entry_new ();
-  gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
 
   /* Create the completion object */
   completion = gtk_entry_completion_new ();
@@ -381,6 +405,8 @@ main (int argc, char *argv[])
   gtk_entry_set_completion (GTK_ENTRY (entry), completion);
   g_object_unref (completion);
   
+  add_with_prop_edit_button (vbox, entry, completion);
+
   /* Create a tree model and use it as the completion model */
   completion_model = GTK_TREE_MODEL (gtk_list_store_new (1, G_TYPE_STRING));
 
@@ -397,7 +423,6 @@ main (int argc, char *argv[])
   gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Model-less entry completion"), FALSE, FALSE, 0);
 
   entry = gtk_entry_new ();
-  gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
 
   /* Create the completion object */
   completion = gtk_entry_completion_new ();
@@ -406,6 +431,8 @@ main (int argc, char *argv[])
   gtk_entry_set_completion (GTK_ENTRY (entry), completion);
   g_object_unref (completion);
   
+  add_with_prop_edit_button (vbox, entry, completion);
+
   gtk_widget_show_all (window);
 
   gtk_main ();